//todo 获取分类列表
import request from "@/utils/request";
export const fetchCateList = () =>
  request({
    url: "http://59.110.226.77:3000/api/category",
  });

export const fetchList = ({
  cid,
  type,
  r,
}: {
  cid: string;
  type: string;
  r: string;
}) =>
  request({
    url: `http://59.110.226.77:3000/api/list/${type}`,
    data: {
      cid,
      r,
    },
  });
export const fetchShow = ({ token }: { token: string }) =>
  request({
    url: "/index.php?r=user/listajax",
    method: "post",
    data: {
      token,
    },
  });
export const fistBrand = () =>
  request({
    url: "api/goods/category-brand-list",
  });
export const fist_brand = () =>
  request({
    url: "api/goods/get-brand-pavilion-setting",
  });
export const fist_brand_body = () =>
  request({
    url: "api/tb-service/get-one-data",
  });
export const fist_brand_body2 = () =>
  request({
    url: "api/tb-service/get-two-data",
  });
export const brand_body = (n: string) =>
  request({
    url: `/api/tb-service/brand-list-by-category-id?typeId=${n}`,
  });

export const star1 = ({
  r,
  token,
  terminal,
}: {
  r: string;
  token: string;
  terminal: string;
}) =>
  request({
    url: `index.php?r=${r}&token=${token}&terminal=${terminal}`,
  });

export const star2 = (data: {
  token: string;
  floor_id: string;
  terminal: string;
}) =>
  request({
    url: "index.php?r=half/getfloorgoods",
    method: "POST",
    data,
  });
export const dis1 = () =>
  request({
    url: "api/goods/super-discount/cate-list/v1",
  });
export const dis2 = (id: string) =>
  request({
    url: `api/goods/super-discount/goods-list/v1?cId=${id}`,
  });
export const mon1 = () =>
  request({
    url: `api/category/single/page/get-single-page?pageId=1&tuserId=771131&entityId=`,
  });
export const mon2 = (categoryId: string) =>
  request({
    url: `api/category/single/page/get-goods-by-categoryId?categoryId=${categoryId}&pageNo=1&pageSize=10&singlePageId=1`,
  });
export const reel1 = () =>
  request({
    url: `api/category/single/page/get-single-page?pageId=2&tuserId=771131&entityId=`,
  });
export const fetchLogin = (data: { username: string; password: string }) =>
  request({
    url: "http://59.110.226.77:3000/api/user/login",
    method: "POST",
    data,
  });
export const fetchRegister = (data: {
  username: string;
  phone: string;
  password: string;
}) =>
  request({
    url: "http://59.110.226.77:3000/api/user/register",
    method: "POST",
    data,
  });
export const fetchToken = (
  userId: string | undefined,
  token: string | undefined
) =>
  request({
    url: "http://59.110.226.77:3000/api/user/getInfo",
    method: "GET",
    data: {
      userId,
      token,
    },
  });
export const fetchShopget = (token: string | undefined) =>
  request({
    url: "http://59.110.226.77:3000/api/shopcar/getCar",
    method: "GET",
    data: {
      token,
    },
  });
export const fetchNineList = ({
  cid,
  pageNo,
  pageSize,
}: {
  cid: string;
  pageNo: string;
  pageSize: string;
}) =>
  request({
    url: `/api/goods/nine/nine-goods-list?cid=${cid}&pageNo=${pageNo}&pageSize=${pageSize}`,
  });

export const fetchNineList1 = () =>
  request({
    url: "/api/goods/nine/one-hour-goods",
  });
export const fetchNineMailList = ({ goodid }: { goodid: string }) =>
  request({
    url: `/api/goods/get-goods-shop-info?goodsId=${goodid}`,
  });
